/*
* File: logfile.h
* Version: 1.0
* Last modified on Fri Mars 07 2014 by group 5
* Members:
* Johan Forsblom, Johanna Carlsson, Dragana Todorovic, 
* Hampus Herbertsson, Robin Henriksson
* -----------------------------------------------------
* This interface provides several functions for logging
* server activity to disk.
*/

#ifndef _LOGFILE_H 
#define _LOGFILE_H

/* Structure for the logfile. */
typedef struct {
	char connectingClient[200];
	char timeStamp[40];
	char command[50];
	char URI[255];
	char response[50];
	char bytes[25];
} logFileT;

/* Function: getLogConnectingClient
* usage: getLogConnectingClient(logFile, client);
* ----------------------------------------------------------------
* This function gets the connected client ip/hostname.
*/
void getLogConnectingClient(logFileT *logFile,char *client);

/* Function: getLogTimeStamp
* usage: getLogTimeStamp(logFile, timeStamp);
* ----------------------------------------------------------------
* This function gets the current server time.
*/
void getLogTimeStamp(logFileT *logFile,char *timeStamp);

/* Function: getLogCommandAndURI
* usage: getLogCommandAndURI(logFile, command, fileName);
* ----------------------------------------------------------------
* This function gets the webb browser command and URI request.
*/
void getLogCommandAndURI(logFileT *logFile,char *command, char *fileName);

/* Function: getLogResponse
* usage: getLogResponse(logFile, response);
* ----------------------------------------------------------------
* This function gets the http response.
*/
void getLogResponse(logFileT *logFile,char *response);

/* Function: getLogfileSize
* usage: getLogfileSize(logFile, bytes);
* ----------------------------------------------------------------
* This function gets the file size.
*/
void getLogfileSize(logFileT *logFile,int bytes);

/* Function: writeLogFile
* usage: writeLogFile(logFile);
* ----------------------------------------------------------------
* This function writes the logfile to disk.
*/
void writeLogFile(logFileT *logFile);

/* Function: clearLogStruct
* usage: clearLogStruct(logFile);
* ----------------------------------------------------------------
* This function clears the log struct.
*/
void clearLogStruct(logFileT *logFile);

#endif
